'''try:
    f = open("test.tex", 'r')
    print("adb")
except:
    f = open("test.txt", "w")
    print("aaaa")
try:
    print(ad)
    print(1 / 0)
except NameError as re:
    print(re)
except ZeroDivisionError:
    print("不能除以零")
try:
    f = open("tdf.java", "r")
except Exception as result:
    f = open("tdf.java", "w")
else:
    print("没有发生异常")
finally:
    f.close()

import time
try:
    f = open("ads.txt")
    try:
        while True:
            con = f.readline()
            if len(con) == 0:
                break
            time.sleep(3)
            print(con)
    except:
        print("程序被意外终止")
except:
    print("该文件不存在")'''

class ShortInputError(Exception):
    def __int__(self, length, min_len):
        self.length = length
        self.min_len = min_len

    def __str__(self):
        return f'你输入的长度是{self.length}, 不能少于{self.min_len}位'

def main():
    try:
        con = input("请输入密码：")
        if len(con) < 3:
            raise ShortInputError(len(con), 3)
    except Exception as res:
        print(res)

    else:
        print("密码已经输入完成")

main()